package com.example.weizix.model;

import com.example.weizix.base.BaseModel;
import com.example.weizix.bean.DailyNewsBean;
import com.example.weizix.net.HttpUtil;
import com.example.weizix.net.ResultCallBack;
import com.example.weizix.net.ResultSubscriber;
import com.example.weizix.net.RxUtils;

public class DailyNewsModel extends BaseModel {
    public void getLatestNews(ResultCallBack<DailyNewsBean> callBack) {
        addcompositeDisposable(
                HttpUtil.getInstance()
                        .getZhihuService()
                        .getLatestNews()
                        .compose(RxUtils.<DailyNewsBean>rxSchedulerHelper())
                        .subscribeWith(new ResultSubscriber<DailyNewsBean>() {
                            @Override
                            public void onNext(DailyNewsBean dailyNewsBean) {
                                callBack.onSuccess(dailyNewsBean);
                            }
                        })
        );
    }
}
